<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card" @tab-remove="removeTab" @tab-click="tabClickclone">
      <!-- <el-tab-pane label="保养标准" name="1">
        <template v-if="activeName === '1'">
          <FrontPage @handleAdd="handleAdd" @UpdateClone="UpdateClone"></FrontPage>
        </template>
      </el-tab-pane> -->
      <el-tab-pane label="保养标准" name="1">
        <template v-if="activeName === '1'">
          <Related></Related>
        </template>
      </el-tab-pane>
      <el-tab-pane label="标准详情" name="3" closable v-if="tabIndex">
        <template v-if="activeName === '3'">
          <Detailed :rowObj="rowObj"></Detailed>
        </template>
      </el-tab-pane>
      <el-tab-pane :label="title" name="4" closable v-if="tabtwo">
        <template v-if="activeName === '4'">
          <CreatedStandard @clear="clear" :title="title" :rowObj="twoObj"></CreatedStandard>
        </template>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  name: "standard",
  // dicts: ['sys_notice_status', 'sys_notice_type'],
  components: {
    FrontPage: () => import('./frontPage/index.vue'),//标准
    Related: () => import('./related/index.vue'),//类型
    Detailed: () => import('./frontPage/form/detailed.vue'),//详情
    CreatedStandard: () => import('./ChildrenList/CreatedStandard.vue')//添加
  },
  data () {
    return {
      activeName: '1',
      tabIndex: false,
      rowObj: {},
      tabtwo: false,
      twoObj: {},
      title: ''
    };
  },
  created () {
  },
  methods: {
    tabClickclone () {
      if (this.activeName === '1' || this.activeName === '2') {
        this.tabIndex = false
        this.tabtwo = false
        this.rowObj = {}
        this.twoObj = {}
      }

      // this.activeName = '1'
    },
    removeTab () {
      this.tabIndex = false
      this.tabtwo = false
      this.activeName = '1'
      this.rowObj = {}
      this.twoObj = {}
    },
    handleAdd () {
      this.title = '添加标准'
      this.tabtwo = true
      this.activeName = '4'
    },
    UpdateClone (row) {
      this.title = '修改标准'
      this.tabtwo = true
      this.activeName = '4'
      this.twoObj = row
    },
    clear () {
      this.tabtwo = false
      this.activeName = '1'
    }
    // addTab(row){
    //   this.tabIndex = true
    //   this.activeName = '3'
    //   this.rowObj = row
    // }
  }
};
</script>
